import axios from '../../utils/axios.js'
import React from  'react'
import NavBar from '../../components/navBar/navBar'
import {Link} from 'react-router-dom'
import './rent.scss'
export default class Rent extends React.Component{
    constructor(){
        super()
        this.state={
            house:[]
        }
    }

    componentDidMount(){
       this.gethouse()
    }
    gethouse=async ()=>{
        let res=await axios.get('/user/houses')
        console.log(res,'5555')
        if(res.status===200){
            this.setState({
                house:res.data.body
            })
        }
    }
    render(){
        let {house}=this.state
        return <div className='rent'>
            <NavBar>房屋管理</NavBar>
            {house.length>0?
                  <div></div>:
                  <div className='no-data'>
                      <img src='http://localhost:8080/img/not-found.png' alt='' className='no-img'></img>
                      <p className='no-test'>您还没有房源，<Link to="/rent/add" >去发布房源 </Link>吧~</p>
                  </div>}
        </div>
    }
}